class SVNUtils
	attr_accessor :verbose
	def run_command(command)
		return %x[#{command}]
	end
	
	def get_repository_revision(svn_root)
		command = "svn info " + svn_root
		repository_revision_regex = /^Revision: (\d*)$/
		output = run_command(command)
		return output.scan(repository_revision_regex)[0][0]
	end

	def svn_copy(from, to, message)
	
		command = "svn copy #{from} #{to} -m \"#{message}\""
		if @verbose then puts command end
		output = run_command(command)
		
		puts "===================[" + "SVN Copy result" + "]==================="
		puts output
		puts "======================================================="
		
	end
	
	def svn_remove_tag(tag_dir,tag_name)
		command = "svn delete #{tag_dir}#{tag_name} --force -m \"Removed tag #{tag_name} by deployer\""
		if @verbose then puts command end
		output = run_command(command)
		
		puts "==================[" + "SVN Remove result" + "]=================="
		puts output
		puts "======================================================="
	end
end